package io.renren.modules.ProjectControl.Service;

import io.renren.modules.ProjectControl.Service.taskService.TaskServiceP2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import java.util.Map;

@Service
@RefreshScope
public class TaskServiceP2iml implements TaskServiceP2 {


    @Autowired
    private RestTemplate restTemplate;
    @Value("${project.p2location}")
    private  String ProjectLocation;


    @Override
    public String hanji(Map<String, Object> param) {



        return  restTemplate.postForObject(ProjectLocation+"/api/hanji",param,String.class);


    }

    @Override
    public String moni_qiegeji(Map<String, Object> param) {
        return  restTemplate.postForObject(ProjectLocation+"/api/moni_qiegeji",param,String.class);
    }

    @Override
    public String queryAll() {
        return  restTemplate.getForObject(ProjectLocation+"/api/all",String.class);
    }

    @Override
    public String hanji1() {
        return  restTemplate.getForObject(ProjectLocation+"/api/hanji1",String.class);
    }

    @Override
    public String hanji2() {
        return  restTemplate.getForObject(ProjectLocation+"/api/hanji2",String.class);
    }

    @Override
    public String fault_qiege() {
        return  restTemplate.getForObject(ProjectLocation+"/api/fault_qiege",String.class);
    }

    @Override
    public String fault_hanji() {
        return  restTemplate.getForObject(ProjectLocation+"/api/fault",String.class);

    }

    @Override
    public String train() {
        return  restTemplate.getForObject(ProjectLocation+"/api/train",String.class);

    }

    @Override
    public String reset() {
        return  restTemplate.getForObject(ProjectLocation+"/api/reset",String.class);

    }

    @Override
    public String lamda() {
        return  restTemplate.getForObject(ProjectLocation+"/api/lamda",String.class);
    }
}
